package com.packt.webdriver.chapter1;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class GoogleSearchByLinkText {
	public static void main(String[] args) {
		WebDriver driver = new FirefoxDriver();
		driver.get("http://www.google.com");
		WebElement aboutLink = driver.findElement(By.partialLinkText("About"));
		System.out.println(aboutLink.getText());
		aboutLink.click();
		WebElement aboutGoogleLinks = driver.findElement(By.xpath(".//*[@id='maia-footer-local']/div/ul/li[2]/ul/li[6]/a"));
		System.out.println(aboutGoogleLinks.getText());
		aboutGoogleLinks.click();
		WebElement clickGoogle = driver.findElement(By.xpath(".//*[@id='maia-header']/div/h1/a/img"));
		clickGoogle.click();
		WebElement findGoogle = driver.findElement(By.cssSelector("#gbqfba"));
		System.out.println(findGoogle.getText());
				
	}
}